<template>
	<view class="withdraw">
		<view class="zhifubao">
			<!-- <view class="topBox">
				<view>
					<text class="custom-icon custom-icon-daifukuan"></text>
					<text>贡献值提现</text>
				</view>
				<view class="detail" @click="goDetail">明细</view>
			</view> -->
			<view class="withdrawBox">
				<view class="inputitem">
					<view class="label">银行名称</view>
					<input type="text" placeholder="请输入银行名称" v-model="form.bank_name" />
				</view>
				<view class="inputitem">
					<view class="label">银行卡号</view>
					<input type="text" placeholder="请输入账户" v-model="form.bank_card_no" />
				</view>
				<view class="inputitem">
					<view class="label">帐户姓名</view>
					<input type="text" placeholder="请输入姓名" v-model="form.bank_user_name" />
				</view>
				<view class="title">提现金额</view>
				<view class="amount">
					<text class="icon">￥</text>
					<input type="digit" placeholder="请输入金额" v-model="form.amount" />
				</view>
				<view class="info mTop2">
					<view class="have">最低提现金额{{this_cash_config.min_cash_amount}}元,可提现金额：{{this_user_info.user_gongxian_balance}}元</view>
					<view class="all" @click="allDraw">全部提现</view>
				</view>

				<button class="application" @click="subForm">提交提现申请</button>
			</view>
			<view class="estimate mTop2">{{this_cash_config.cash_tips_1}}</view>
		</view>
	</view>
</template>

<script>
	var util = require('../../common/util.js');
	var common_utils = require('../../common/common_utils.js');
	export default {
		data() {
			return {
				form: {
					account_type: '',
					alipay_account: '',
					alipay_account_name: '',
					bank_name: '',
					bank_card_no: '',
					bank_user_name: '',
					amount: '',
					arrival_amount: 0,
					pay_account_id: 0,
					pay_code: ''
				},
				this_cash_config:{},
				this_user_info:{}
			}
		},
		onLoad(options) {
			this.loadData();
		},
		methods: {
			loadData: function() {
				// 加载数据
				var that = this;
				util.requestPost("api.php/Gongxian/index", {}, function(res) {
					that.this_cash_config = res.data.this_cash_config;
					that.this_user_info = res.data.this_user_info;
				}, true);
			},
			goDetail() {
				uni.navigateTo({
					url: '/pages/my/withdrawDetail'
				})
			},
			allDraw() {
				this.form.amount = this.this_user_info.user_gongxian_balance;
			},
			subForm() {
				let that = this;
				util.requestPost("api.php/Gongxian/confirmCash", that.form, function(res) {
					uni.showModal({
						title: '提示',
						content: res.msg,
						showCancel: false,
						success: function(res) {
							uni.switchTab({
								url:'/pages/my/my'
							});
						}
					});
				},true);
			}
		}
	}
</script>

<style scoped>
	.withdraw {
		padding: 20rpx 32rpx;
		min-height: 100%;
		background-color: var(--bgColor);
	}

	.subsection {
		padding-bottom: 20rpx;
	}

	.topBox {
		font-size: 28rpx;
		color: #666666;
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.topBox .custom-icon {
		color: var(--primaryColor);
		margin-right: 8rpx;
	}

	.topBox .detail {
		color: var(--primaryColor);
	}

	.withdrawBox {
		padding: 20rpx;
		background-color: #ffffff;
		border-radius: 12rpx;
		margin-top: 20rpx;
	}

	.withdrawBox .title {
		font-size: 28rpx;
	}

	.withdrawBox .amount {
		display: flex;
		align-items: center;
		margin-top: 20rpx;
		padding: 20rpx 0;
		border-bottom: 1rpx solid #eeeeee;
	}

	.withdrawBox .amount .icon {
		font-size: 52rpx;
	}

	.withdrawBox .amount input {
		flex: 1;
		height: 70rpx;
		font-size: 48rpx;
	}

	.withdrawBox .info {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-size: 24rpx;
	}

	.withdrawBox .info .have {
		color: #666666;
	}

	.withdrawBox .info .all {
		color: var(--primaryColor);
	}

	.withdrawBox .application {
		width: 100%;
		border-radius: 60rpx;
		color: #ffffff;
		font-size: 28rpx;
		letter-spacing: 8rpx;
		background: var(--btnBgColor);
		margin: 60rpx 0 20rpx 0;
	}

	.estimate {
		text-align: center;
		font-size: 24rpx;
		color: #666666;
	}

	.inputitem {
		display: flex;
		align-items: center;
		justify-content: center;
		padding-bottom: 20rpx;
		line-height: 60rpx;
	}

	.inputitem .label {
		font-size: 28rpx;
		width: 140rpx;
		margin-right: 20rpx;
	}

	.inputitem input {
		flex: 1;
		font-size: 28rpx;
	}

	.tips {
		position: absolute;
		top: 40%;
		left: 50%;
		transform: translate(-50%, -50%);
		text-align: center;
		font-size: 36rpx;
		color: var(--primaryColor);
	}
</style>
